# _*_ coding: utf-8 _*_
# @Time:2023/11/23 16:53
# @Author:10917
# @File:basicbootstrap.py
from django import forms


class BasicBootStrap:
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # 循环找到所有的插件，添加了BootStrap样式 class="form-control"
        for name, field in self.fields.items():
            # if name == "password":
            #     continue
            field.widget.attrs = {"class": "form-control", "placeholder": field.label}


class BootStrapModelForm(BasicBootStrap, forms.ModelForm):
    pass


class BootStrapForm(BasicBootStrap, forms.Form):
    pass
